/*
ID:puretears
PROG:Herdle
LANG:C++17
*/
#include <set>
#include <map>
#include <string>
#include <vector>
#include <iostream>


using namespace std;
int main(int argc, char *argv[]) {
  // We use a set to store each unique character
  // in the answer.
  set<char> characters;

  map<char, int> dic;
  
  // Initialize the answer and guess matrix
  vector<char> row(3, '\0');
  vector<vector<char>> answer(3, row);
  vector<vector<char>> guess(3, row);
  
  // Read the answer from cin.
  for (int row = 0; row < 3; ++row) {
    string line;
    cin >> line;

    for (int col = 0; col < 3; ++col) {
      char c = line.at(col);
      answer[row][col] = c;
      // We can store the unique characters by the set
      // while we collect them from cin by the way.
      if (dic.find(c) != dic.end()) {
        ++dic[c];
      }
      else {
        dic[c] = 1;
      }
    }
  }
  
  // Read the guess from cin.
  for (int row = 0; row < 3; ++row) {
    string line;
    cin >> line;

    for (int col = 0; col < 3; ++col) {
      char c = line.at(col);
      guess[row][col] = c;
    }
  }
  
  int green = 0, yellow = 0;
  
  // Traverse the guess matrix:
  // - If we find the same character at the same position, 
  //   we turn on a green light.
  // - Or we can check if the character exists in the set
  for (int row = 0; row < 3; ++row) {
    for (int col = 0; col < 3; ++col) {
      char c = guess[row][col];
      if (c == answer[row][col]) {
        ++green;
        --dic[c];
      }
      else {
        if (dic.find(c) != dic.end()) {
          if (dic[c] > 0) {
            ++yellow;
            --dic[c];
          }
        }
      }
    }
  }
  
  cout << green << endl << yellow << endl;
  
  return 0;
}